package com.dragon.repository.config;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;


/**
 * @author Charlotte
 * 自动填充字段值
 */
@Component
public class AutoFillHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        //this.setFieldValByName("lessor","重庆腾龙市政设施有限公司",metaObject);
        this.setFieldValByName("createTime", DateUtil.date(),metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.setFieldValByName("updateTime",DateUtil.date(),metaObject);
    }
}
